<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>个人中心</title>
    <link rel="stylesheet" href="../static/css/user_center.css"> 
</head>
<body>
<div class="my-layout">
    <!-- 左侧导航栏 -->
    <aside class="my-sidebar sidebar">
        <div class="sidebar-user">
            <img src="{{if .avatarURL}}{{.avatarURL}}{{else}}/static/img/default_user.jpg{{end}}" alt="头像" class="sidebar-avatar avatar">
            <div class="sidebar-username username">{{.username}}</div>
        </div>
        <nav class="sidebar-menu">
            <div class="menu-item">
            </div>
            <div class="menu-item dropdown">
                <div class="menu-title collapsible" data-target="trade-menu">
                    <div style="display: flex; align-items: center;">
                        <i>📦</i>
                        <span>我的交易</span>
                    </div>
                </div>
            </div>
            <div class="submenu open" id="trade-menu">
                <a href="/my/items" class="menu-item"><span>我发布的</span></a>
                <a href="/my/sold" class="menu-item"><span>我卖出的</span></a>
                <a href="/my/bought" class="menu-item"><span>我买到的</span></a>
            </div>
            
            <div class="menu-item">
                <i>⭐</i>
                <span>我的收藏</span>
            </div>
            
            <div class="menu-item dropdown">
                <div class="menu-title collapsible active" data-target="account-menu">
                    <div style="display: flex; align-items: center;">
                        <i>⚙️</i>
                        <span>账户设置</span>
                    </div>
                </div>
            </div>
            <div class="submenu open" id="account-menu">
                <a href="/user/profile" class="menu-item"><span>个人资料</span></a>
                <a href="/user/security" class="menu-item"><span>账号与安全</span></a>
            </div>
            
            <div class="menu-item">
                <a href="/logout" class="menu-item logout">
                    <i>🚪</i>
                    <span>退出登录</span>
                </a>
            </div>
        </nav>
    </aside>
    
    <!-- 主内容区域 - 统一容器 -->
    <main class="my-main main-content">
        <div class="main-container">
            <!-- 用户资料区域 -->
            <div class="profile-section">
                <div class="avatar">
                    <img src="{{if .avatarURL}}{{.avatarURL}}{{else}}/static/img/default_user.jpg{{end}}" alt="头像" class="main-avatar">
                </div>
                <div class="user-info">
                    <div class="main-username">{{.username}}</div>
                    <div class="user-stats">
                        <span>河南省</span>
                        <span>0粉丝</span>
                        <span>0关注</span>
                    </div>
                </div>
                <a href="/user/profile/edit" class="edit-btn">编辑资料</a>
            </div>
            
            <!-- 标签导航区域 -->
            <div class="tabs-section">
                <div class="tab active">主页</div>
                <div class="tab">信用及评价</div>
            </div>
            
            <!-- 内容区域 -->
            <div class="content-section">
                <img src="https://placeholder.svg?height=120&width=120" alt="暂无商品">
                <div class="empty-text">暂无商品</div>
            </div>
        </div>
    </main>
</div>

<script>
document.querySelectorAll('.collapsible').forEach(function(title){
    title.addEventListener('click', function(){
        var target = document.getElementById(this.dataset.target);
        if(target){
            target.classList.toggle('open');
            this.classList.toggle('active');
        }
    });
});

document.querySelectorAll('.tab').forEach(function(tab){
    tab.addEventListener('click', function(){
        document.querySelectorAll('.tab').forEach(function(t){
            t.classList.remove('active');
        });
        this.classList.add('active');
    });
});
</script>
</body>
</html>